# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Thomas S Hatch <thatch45@gmail.com>
# Contributor: shamrok <szamrok@gmail.com>
# Contributor: scj <scj archlinux us>

pkgname=python-levenshtein
pkgver=0.23.0
pkgrel=1
pkgdesc='Python extension for computing string edit distances and similarities'
arch=('loong64' 'x86_64')
url='https://github.com/maxbachmann/Levenshtein'
license=('GPL')
depends=(
  'glibc'
  'gcc-libs'
  'python'
  'python-rapidfuzz'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-scikit-build'
  'cython'
  'rapidfuzz-cpp'
)
checkdepends=('python-pytest')
_commit='b6069c7940e9274e54b2924d24e3e9861ee3ad34'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  PYTHONPATH=`echo "$(pwd)"/_skbuild/linux-${CARCH}-*/setuptools/lib.linux-${CARCH}-*` \
  pytest -v
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl
}
